export class RadarOverlay extends BMapGL.Overlay {
  constructor(point, item) {
    super();
    this._point = point;
    this._title = item.title;
    this._text = item.text
    this._showType = "typeDiv"
  }

  initialize(map) {
    this._map = map;
    let div = this._div = document.createElement("div");
    div.setAttribute('class', 'map-circle');
    div.setAttribute('data-lng', this._point.lng);
    div.setAttribute('data-lat', this._point.lat);
    let pTitle = document.createElement("p");
    pTitle.setAttribute('class', 'map-title');
    pTitle.appendChild(document.createTextNode(this._title));
    div.appendChild(pTitle);

    let pText = document.createElement("p");
    pText.setAttribute('class', 'map-text');
    div.appendChild(pText);
    pText.appendChild(document.createTextNode(this._text));
    map.getPanes().markerPane.appendChild(div);
    this._div = div;
    return div;
  }

  draw() {
    let map = this._map;
    let pixel = map.pointToOverlayPixel(this._point);
    this._div.style.left = pixel.x + "px";
    this._div.style.top = pixel.y + "px";
    // 根据地理坐标转换为像素坐标，并设置给容器
  }

  addEventListener(event, fun) {
    this._div['on' + event] = fun;
  }
}
